package com.breakfast.fun.data.entity.home.product;

import com.breakfast.fun.data.entity.home.Product;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/9/6.
 */
public class ProductDetail {

    /**
     * total : 9
     * pageTotal : 9
     * data : [{"id":380,"des":"花生芝麻馍+五谷红豆馍+绿豆汤","price":7.9,"shopId":42,"categoryId":187,"name":"花生芝麻馍+五谷红豆馍+绿豆汤","closetime":"22:00:00","sellcount":6,"image":"http://m.52letsgo.cn/product_image/9/6/78f1e125-e_840769087.jpg","className":"包点类","bigImage":"http://m.52letsgo.cn/product_image/7/6/47ec4cb7-f_1114151232.jpg","sdes":"<br /><progress style=\"position: fixed; left: 0px; bottom: 0px; display: none; z-index: 99999;\">\t&nbsp;<\/progress><progress style=\"position: fixed; left: 0px; bottom: 0px; display: none; z-index: 99999;\">\t&nbsp;<\/progress>"},{"id":379,"des":"爱心豆沙包+2个烧麦+黑强肾豆浆","price":8.9,"shopId":28,"categoryId":186,"name":"爱心豆沙包套餐","closetime":"22:00:00","sellcount":21,"image":"http://m.52letsgo.cn/product_image/1/2/19ab2b89-e_-573756962.jpg","className":"包点类","bigImage":"http://m.52letsgo.cn/product_image/9/6/596679e3-2_499645282.jpg","sdes":"<br /><progress style=\"position: fixed; left: 0px; bottom: 0px; display: none; z-index: 99999;\">\t&nbsp;<\/progress><progress style=\"position: fixed; left: 0px; bottom: 0px; display: none; z-index: 99999;\">\t&nbsp;<\/progress>"},{"id":359,"des":"脆笋鲜肉馍+五谷蜜红豆馍+黑米汁","price":8.9,"shopId":42,"categoryId":169,"name":"五谷蜜红豆馍套餐","closetime":"22:00:00","sellcount":53,"image":"http://m.52letsgo.cn/product_image/5/1/40f1feed-2_-1895146008.jpg","className":"包点类","bigImage":"http://m.52letsgo.cn/product_image/6/11/a27444f7-3_296254635.jpg","sdes":""},{"id":353,"des":"四方叉烧包+秘制茶叶蛋+原味豆浆","price":8.9,"shopId":26,"categoryId":163,"name":"四方叉烧包套餐","closetime":"22:00:00","sellcount":87,"image":"http://m.52letsgo.cn/product_image/6/15/8ff78f9d-c_-1869595077.jpg","className":"包点类","bigImage":"http://m.52letsgo.cn/product_image/15/15/e925d89b-7_-761769411.jpg","sdes":""},{"id":345,"des":"爆汁流沙包*1+叉烧包*1+原味豆浆*1","price":9.5,"shopId":26,"categoryId":156,"name":"荤素双搭套餐","closetime":"22:00:00","sellcount":411,"image":"http://m.52letsgo.cn/product_image/3/5/41e45311-1_-488340506.jpg","className":"包点类","bigImage":"http://m.52letsgo.cn/product_image/8/14/c3edbad3-6_-1033417358.jpg","sdes":""},{"id":343,"des":"金包银*1+香酥热狗包*1+花生燕麦豆浆*1","price":8.5,"shopId":28,"categoryId":154,"name":"Q皮金包银套餐","closetime":"22:00:00","sellcount":174,"image":"http://m.52letsgo.cn/product_image/1/1/d002c6b1-9_1165837152.jpg","className":"包点类","bigImage":"http://m.52letsgo.cn/product_image/15/10/1a9c9f67-6_650203102.jpg","sdes":""},{"id":339,"des":"爆汁流沙馍*1+黄金胚芽馍*1+黑米汁*1","price":8.9,"shopId":42,"categoryId":150,"name":"黄金胚芽馍套餐","closetime":"22:00:00","sellcount":75,"image":"http://m.52letsgo.cn/product_image/4/15/563521ca-7_-1237773203.jpg","className":"包点类","bigImage":"http://m.52letsgo.cn/product_image/14/6/ff2b07b3-2_-1740037102.jpg","sdes":""},{"id":332,"des":"玉米鲜肉馍+五谷黑糖馍+黄豆汁","price":7.9,"shopId":42,"categoryId":142,"name":"玉米鲜肉馍套餐","closetime":"22:00:00","sellcount":100,"image":"http://m.52letsgo.cn/product_image/9/1/2330f4d3-3_-1198068818.jpg","className":"包点类","bigImage":"http://m.52letsgo.cn/product_image/4/1/dde31ea9-f_-805593311.jpg","sdes":""},{"id":331,"des":"香菇鲜肉包+香辣盐菜馍+黑米汁","price":7.9,"shopId":42,"categoryId":141,"name":"香辣盐菜馍套餐","closetime":"22:00:00","sellcount":120,"image":"http://m.52letsgo.cn/product_image/1/9/6da0af38-8_1703166746.jpg","className":"包点类","bigImage":"http://m.52letsgo.cn/product_image/10/0/c1db0adb-e_-844603129.jpg","sdes":""}]
     * msg : 查询成功
     * success : true
     */

    private int total;
    private int pageTotal;
    private String msg;
    private boolean success;
    /**
     * id : 380
     * des : 花生芝麻馍+五谷红豆馍+绿豆汤
     * price : 7.9
     * shopId : 42
     * categoryId : 187
     * name : 花生芝麻馍+五谷红豆馍+绿豆汤
     * closetime : 22:00:00
     * sellcount : 6
     * image : http://m.52letsgo.cn/product_image/9/6/78f1e125-e_840769087.jpg
     * className : 包点类
     * bigImage : http://m.52letsgo.cn/product_image/7/6/47ec4cb7-f_1114151232.jpg
     * sdes : <br /><progress style="position: fixed; left: 0px; bottom: 0px; display: none; z-index: 99999;">	&nbsp;</progress><progress style="position: fixed; left: 0px; bottom: 0px; display: none; z-index: 99999;">	&nbsp;</progress>
     */

    private List<Product> data;

    public static ProductDetail objectFromData(String str) {

        return new Gson().fromJson(str, ProductDetail.class);
    }

    public static List<ProductDetail> arrayProductDetailFromData(String str) {

        Type listType = new TypeToken<ArrayList<ProductDetail>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(int pageTotal) {
        this.pageTotal = pageTotal;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public List<Product> getData() {
        return data;
    }

    public void setData(List<Product> data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "ProductDetail{" +
                "total=" + total +
                ", pageTotal=" + pageTotal +
                ", msg='" + msg + '\'' +
                ", success=" + success +
                ", data=" + data +
                '}';
    }
}
